package com.study.spark.scala.chapter07

import scala.collection.mutable


object Scala08_Collection_Map{
  def main(args: Array[String]): Unit = {
    // TODO 集合 - Map
    // 存储的是K-V键值对
    // 数据无序，k不可重复，v可以重复
    val map =Map("a" -> 1,"b" -> 2,"c" -> 3,"a" -> 10,"d" -> 4,"e" -> 4)
    println(map)//Map(e -> 4, a -> 10, b -> 2, c -> 3, d -> 4)

    // 可变Map：mutable.Map
    val mMap = mutable.Map("a" -> 1,"b" -> 2,"c" -> 3,"a" -> 10,"d" -> 4,"e" -> 4)
    mMap.put("f" , 666)
    mMap.update("c",999)
    mMap.remove("d")
    println(mMap)//Map(e -> 4, b -> 2, a -> 10, c -> 999, f -> 666)
  }
}
